package com.huarui.department.dao.impl;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.ewaf.framework.dao.impl.BaseDaoImpl;

import org.ewaf.framework.model.IDataObject;
import org.ewaf.framework.model.ListModel;

import com.huarui.department.dao.IDepartmentDao;
import com.huarui.department.model.Department;


public class DepartmentDaoImpl extends BaseDaoImpl implements IDepartmentDao {


	@SuppressWarnings("unchecked")
	@Override
	public List<Department> getAll() {
		return getSqlMapClientTemplate().queryForList(namespace+".getAll");
		 
	}

	@Override
	public Department getByEmployeeId(Integer employeeId){
		
		return (Department)getSqlMapClientTemplate().queryForObject(namespace+".getByEmployeeId",employeeId);
	}
	@SuppressWarnings("unchecked")
	@Override
	public ListModel getBypagination(ListModel listMode) {
		Map map=new HashMap(); 
		map.put("page",listMode);
		this.getSqlMapClientTemplate().queryForList(namespace+".getByPagination", map);
		return null;
	}

	@SuppressWarnings("unchecked")
	@Override
	public Department getByName(Map map) {
		
		return (Department)getSqlMapClientTemplate().queryForObject(namespace+".getByName",map);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List getDepartmentsByConditions(Map map) {
		
		return this.getSqlMapClientTemplate().queryForList(
				namespace + ".getDepartmentsByConditions",map);
		
	}

	@SuppressWarnings("unchecked")
	@Override
	public Integer getByConditionsForCount(Map map) {
		return (Integer) this.getSqlMapClientTemplate().queryForObject(namespace+".getByConditionsForCount",map);
	
	}

	@Override
	public Department getByisDefault(Integer companyId) {
		
		return (Department) getSqlMapClientTemplate().queryForObject(namespace + ".getByisDefault",companyId);
	}

}
